#include<iostream>
#include<sys/types.h>
#include<sys/stat.h>
#include<cstdio>
#include<fcntl.h>
#include<unistd.h>
using namespace std;
int main()
{
    int f = mkfifo("./file",0666);
    int r_fd = open("file",O_RDONLY);
    char buf[1024];
    while(true)
    {
        int n = read(r_fd,buf,sizeof(buf)-1);
        if(n > 0)
        {
            buf[n]='\0';
            printf("Client say# %s\n",buf);
        }
        else if(n == 0) break;
        else return 1;

    }
    close(r_fd);
    unlink("file");
    return 0;
}
